package cn.iocoder.yudao.module.handguard.dal.mysql.publicitynotice;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.handguard.dal.dataobject.publicitynotice.PublicityNoticeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.handguard.controller.admin.publicitynotice.vo.*;

/**
 * 通用公示 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PublicityNoticeMapper extends BaseMapperX<PublicityNoticeDO> {

    default PageResult<PublicityNoticeDO> selectPage(PublicityNoticePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PublicityNoticeDO>()
                .eqIfPresent(PublicityNoticeDO::getClassify, reqVO.getClassify())
                .eqIfPresent(PublicityNoticeDO::getContent, reqVO.getContent())
                .eqIfPresent(PublicityNoticeDO::getKeyValue, reqVO.getKeys())
                .eqIfPresent(PublicityNoticeDO::getState, reqVO.getStatus())
                .betweenIfPresent(PublicityNoticeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PublicityNoticeDO::getId));
    }

    default List<PublicityNoticeDO> selectList(PublicityNoticeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PublicityNoticeDO>()
                .eqIfPresent(PublicityNoticeDO::getClassify, reqVO.getClassify())
                .eqIfPresent(PublicityNoticeDO::getContent, reqVO.getContent())
                .eqIfPresent(PublicityNoticeDO::getKeyValue, reqVO.getKeyValue())
                .eqIfPresent(PublicityNoticeDO::getState, reqVO.getState())
                .betweenIfPresent(PublicityNoticeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PublicityNoticeDO::getId));
    }

}
